package entity;
// default package

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * News entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "news", catalog = "house")
public class News implements java.io.Serializable {

	// Fields

	private Integer id;
	private Newstypes newstypes;
	private String NTitle;
	private String NContent;
	private Date NTime;
	private String NFrom;
	private Integer NCritique;
	private Integer NState;
	private Integer consumerid;
	private Set<Critique> critiques = new HashSet<Critique>(0);

	// Constructors

	/** default constructor */
	public News() {
	}

	/** minimal constructor */
	public News(Newstypes newstypes, String NTitle, String NContent,
			Date NTime, String NFrom) {
		this.newstypes = newstypes;
		this.NTitle = NTitle;
		this.NContent = NContent;
		this.NTime = NTime;
		this.NFrom = NFrom;
	}

	/** full constructor */
	public News(Newstypes newstypes, String NTitle, String NContent,
			Date NTime, String NFrom, Integer NCritique, Integer NState,
			Integer consumerid, Set<Critique> critiques) {
		this.newstypes = newstypes;
		this.NTitle = NTitle;
		this.NContent = NContent;
		this.NTime = NTime;
		this.NFrom = NFrom;
		this.NCritique = NCritique;
		this.NState = NState;
		this.consumerid = consumerid;
		this.critiques = critiques;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "newstypeid", nullable = false)
	public Newstypes getNewstypes() {
		return this.newstypes;
	}

	public void setNewstypes(Newstypes newstypes) {
		this.newstypes = newstypes;
	}

	@Column(name = "n_title", nullable = false, length = 100)
	public String getNTitle() {
		return this.NTitle;
	}

	public void setNTitle(String NTitle) {
		this.NTitle = NTitle;
	}

	@Column(name = "n_content", nullable = false, length = 65535)
	public String getNContent() {
		return this.NContent;
	}

	public void setNContent(String NContent) {
		this.NContent = NContent;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "n_time", nullable = false, length = 10)
	public Date getNTime() {
		return this.NTime;
	}

	public void setNTime(Date NTime) {
		this.NTime = NTime;
	}

	@Column(name = "n_from", nullable = false, length = 50)
	public String getNFrom() {
		return this.NFrom;
	}

	public void setNFrom(String NFrom) {
		this.NFrom = NFrom;
	}

	@Column(name = "n_critique")
	public Integer getNCritique() {
		return this.NCritique;
	}

	public void setNCritique(Integer NCritique) {
		this.NCritique = NCritique;
	}

	@Column(name = "n_state")
	public Integer getNState() {
		return this.NState;
	}

	public void setNState(Integer NState) {
		this.NState = NState;
	}

	@Column(name = "consumerid")
	public Integer getConsumerid() {
		return this.consumerid;
	}

	public void setConsumerid(Integer consumerid) {
		this.consumerid = consumerid;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "news")
	public Set<Critique> getCritiques() {
		return this.critiques;
	}

	public void setCritiques(Set<Critique> critiques) {
		this.critiques = critiques;
	}

}